system_mt = { --this table cannot be local, because the __index goes on recursively
  system = function() 
    return "classIV"
  end,  
  now = function() 
    return os.date()
  end,
  clock = function() 
    return os.clock()
  end,  
  here = function()
    return 0
  end,
  ip = function()
    local socket = socket or require"socket"
    if socket then
      return socket.dns.toip(socket.dns.gethostname())
    else
      return "0.0.0.0"
    end  
  end,
  hostname = function()
    local socket = socket or require"socket"
    if socket then
      return socket.dns.gethostname()
    else
      return "LOCALHOST"
    end  
  end,
  machine = function()
    return os.getenv("COMPUTERNAME")
  end,
  user = function()
    return os.getenv("USERNAME")
  end,
  appdatapath = function()
    return os.getenv("APPDATA")
  end,
  homepath = function()
    return os.getenv("HOMEPATH")
  end,
  userprofile = function()
    return os.getenv("USERPROFILE")
  end, 
  line = function()
    local t = debug.getinfo(3,'l')
    return t.currentline
  end,
  source = function()
    local t = debug.getinfo(3,'S')
    return t.source
  end,
  __index = function(t,k)
    if system_mt[k] then --Global variables 
      return system_mt[k]()
    end 
  end,  
}

setmetatable(_G,system_mt)
